//
//  ByBallBetDetailView.m
//  caipiao_ios
//
//  Created by mc on 2018/8/15.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByBallBetDetailView.h"
#import "ByBallBetDetailValueView.h"


@implementation ByBallBetDetailView

- (id)init{
    self = [super init];
    if (self) {
        CGFloat titleHeight = 40;
        CGFloat width = (SCREEN_WIDTH - 10) / 3.0;
        
        for (int i = 0; i < 3; i++) {
            UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(width * i, 0, width, titleHeight)];
            [self addSubview:titleLabel];
            titleLabel.textColor = [UIColor blackColor];
            titleLabel.font = FONT(12);
            titleLabel.textAlignment = NSTextAlignmentCenter;
            if (i == 0) {
                titleLabel.text = @"主队 VS 客队";
            }else if (i == 1){
                titleLabel.text = @"赛果";
            }else if (i == 2){
                titleLabel.text = @"投注内容";
            }
            titleLabel.backgroundColor = rgba(248, 248, 248, 1);
        }
        
        
    }
    return self;
}


- (void)setItemsArray:(NSMutableArray *)itemsArray{
    _itemsArray = itemsArray;
    CGFloat top = 40;
    for (int i = 0; i < itemsArray.count; i++) {
        ByNetModel *netModel = [_itemsArray objectAtIndex:i];
        ByBallBetDetailValueView *valueView = [[ByBallBetDetailValueView alloc] initWithFrame:CGRectMake(0, top, SCREEN_WIDTH - 10, Table_Height)];
        [self addSubview:valueView];
        top = top + Table_Height;
        valueView.netModel = netModel;
        valueView.netModel.name = _type;
     }
    top = 40 + Table_Height;
    for (int i = 0; i < itemsArray.count; i++) {
        UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(0, top + i * Table_Height, SCREEN_WIDTH - 10, 1)];
        [self addSubview:line];
        line.backgroundColor = BY_LINE_COLOR;
    }
    CGFloat width = (SCREEN_WIDTH - 10) / 3.0;
    for (int i = 0; i < 3; i++) {
        UILabel *line = [[UILabel alloc] init];
        [self addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self).offset(0);
            make.bottom.equalTo(self).offset(0);
            make.width.mas_equalTo(@1);
            make.left.equalTo(self).offset(width + width * i);
        }];
        line.backgroundColor = BY_LINE_COLOR;
    }
    
}

@end
